﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
using Aspose.Words;
using Aspose.Words.Rendering;

namespace FileConvert.AsposeOper
{
    public class WordFile
    {
        public WordFile(string fromFile, string toFile)
        {
            _formFile = fromFile;
            _toFile = toFile;
            AsposeRegister.Register_Words();
            Aspose.Words.Fonts.FontSettings fs = new Aspose.Words.Fonts.FontSettings();
            fs.SetFontsFolders(FontClass.GetSystemFontList().ToArray(), true);
            doc = new Aspose.Words.Document(_formFile);
            doc.FontSettings = fs;
        }
        ~WordFile()
        {
            doc = null;
        }
        Aspose.Words.Document doc;
        private string _formFile = "";
        private string _toFile = "";
        public void ConvertToPdf()
        {
           
            doc.Save(_toFile, SaveFormat.Pdf);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public void ConvertToXPS()
        {
           
            doc.Save(_toFile, SaveFormat.Xps);
        }


        public void ConvertToHTML()
        {           
            doc.Save(_toFile, SaveFormat.Html);
        }

        public void ConvertToEPub()
        {            
            doc.Save(_toFile, SaveFormat.Epub);
        } 
    }
}
